package com.goushu.controller;

import com.goushu.pojo.Result;
import com.goushu.service.NewsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/news")
@Slf4j
public class NewsController {

    @Autowired
    private NewsService newsService;

    /**
     * 获取主页滚动图片
     * @return
     */
    @GetMapping("/carousel")
    public Result<List<Map<String, String>> > getCarousel() {
        List<Map<String, String>> map = newsService.getCarousel();
        return Result.success(map);
    }

    /**
     * 获取图书快报
     * @return
     */
    @GetMapping("/express")
    public Result<List<Map<String, String>> > getExpress() {
        List<Map<String, String>> map = newsService.getExpress();
        return Result.success(map);
    }
}
